package com.example.touch.location;

import android.graphics.Point;

public abstract class AbstractLocation implements IEvaluableObjectLocation
{
	protected abstract boolean handleIsWithin(Point currentPosition, int radius);
	private String objLocationID;
	private String objLocationName;
	
	@Override
	public String getObjectLocationID()
	{
		return objLocationID;
	}
	
	@Override
	public String getObjectLocationName()
	{
		return objLocationName;
	}
	
	@Override
	public void setObjectLocationID(String identifier)
	{
		objLocationID = identifier;
	}
	
	@Override
	public void setObjectLocationName(String name)
	{
		objLocationName = name;
	}
	
	@Override
	public boolean isWithin(Point currentPosition, int radius)
	{
		return handleIsWithin(currentPosition, radius);
	}
	
	protected double calcDistance(Point p1, Point p2)
	{
		double x = Math.pow((p2.x - p1.x), 2);
		double y = Math.pow((p2.y - p1.y), 2);
		return Math.sqrt(x + y);
	}
}
